package tt.dz.appserver.util;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 系统推送公共类
 * @author alex
 *
 */
public class sysPushUtil extends Thread{
	
	public static int  threadNum=5;
	static ExecutorService  pool=null;
	//初始化线程池
	public static void init(){
		
		 pool = Executors.newFixedThreadPool(threadNum); 
	}
	//按条件获取所有用户
	//获取websocket推送用户
	//剩下的用户极光推送
	public static void  startThread(Thread  thread){
		pool.execute(thread);
		
	}
	public static void  close(){
		pool.shutdown();
	}
	
	public void start(int i){			
			System.out.println(i);
	}
	public static void main(String[] args) {
		init();
		sysPushUtil sy=new sysPushUtil();
		for(int i=0;i<30;i++){
			if(i/10==0){
				sy= new sysPushUtil();
				sy.startThread(sy);
			}			
		}
		
	}

}
